﻿/***************************************************************************
*		功能：     银行卡（收支方式）实体类(代码生成工具搞定的)
*		作者：     Sands
*		日期：     2012-09-08 06:26
*		
*		修改日期：
*		修改人：
*		修改内容：
/* *************************************************************************/
using System;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.IO;
using System.Text;
using System.Data;
using Sands.DataAccess;
using Sands.Common;
using System.Collections.Generic;
using System.Linq;
namespace SAWeb.Model
{
	/// <summary>
	/// 银行卡（收支方式）
	/// </summary>
	[Serializable]
	[HTable( TableName = "Card" ,  Remake = "银行卡（收支方式）")]
	public partial class Card :  IModel 
	{
        /// <summary>
        /// 是否新参数
        /// </summary>
        public bool IsNewModel() { return CardId == 0; } 

	    
		/// <summary>
		/// 卡ID
		/// </summary>
		[HColumn( Remake = "卡ID" ,  IsPrimary = true ,  IsIdentity = true)]
		public int CardId { set; get; }
        

		/// <summary>
		/// 卡名称
		/// </summary>
		[HColumn( Remake = "卡名称" ,  Length = 50 ,  IsNullable = true)]
		public string Name { set; get; }
        

		/// <summary>
		/// 所属银行
		/// </summary>
		[HColumn( Remake = "所属银行" ,  Length = 50 ,  IsNullable = true)]
		public string Bank { set; get; }
        

		/// <summary>
		/// 卡号
		/// </summary>
		[HColumn( Remake = "卡号" ,  Length = 20 ,  IsNullable = true)]
		public string Num { set; get; }
        

		/// <summary>
		/// 余额
		/// </summary>
		[HColumn( Remake = "余额" ,  Length = 10)]
		public string Money { set; get; }
        

		/// <summary>
		/// 每月消费记录
		/// </summary>
		[HColumn( Remake = "每月消费记录" ,  IsNullable = true)]
		public string Record { set; get; }
        

		/// <summary>
		/// 卡类型
		/// </summary>
		[HColumn( Remake = "卡类型")]
		public int Type { set; get; }
        

		/// <summary>
		/// 用户
		/// </summary>
		[HColumn( Remake = "用户")]
		public int UsersId { set; get; }
        

		
		
        
		private Lazy<Users> _Users;
        [NotColumn]
		public  Lazy<Users> Users 
		{ 
			get
			{
				if (_Users.IsNotNull()) return _Users;
				else
				{
					_Users = new Lazy<Users>(() => { return new BaseService<Users>().GetModelById(UsersId); });
					return _Users;
				}			
			}
		}
		


		
	}

	public partial class Db
	{
			public static class Card 
			{

				static  Card ()
				{
				 
					CardId = new Field("Card","CardId");
				 

					Name = new Field("Card","Name");
				 

					Bank = new Field("Card","Bank");
				 

					Num = new Field("Card","Num");
				 

					Money = new Field("Card","Money");
				 

					Record = new Field("Card","Record");
				 

					Type = new Field("Card","Type");
				 

					UsersId = new Field("Card","UsersId");
				 

				}
    			 
				 /// <summary>
				 /// 卡ID
				 /// </summary>
				 public static Field CardId { private set;get; }
	    		 

				 /// <summary>
				 /// 卡名称
				 /// </summary>
				 public static Field Name { private set;get; }
	    		 

				 /// <summary>
				 /// 所属银行
				 /// </summary>
				 public static Field Bank { private set;get; }
	    		 

				 /// <summary>
				 /// 卡号
				 /// </summary>
				 public static Field Num { private set;get; }
	    		 

				 /// <summary>
				 /// 余额
				 /// </summary>
				 public static Field Money { private set;get; }
	    		 

				 /// <summary>
				 /// 每月消费记录
				 /// </summary>
				 public static Field Record { private set;get; }
	    		 

				 /// <summary>
				 /// 卡类型
				 /// </summary>
				 public static Field Type { private set;get; }
	    		 

				 /// <summary>
				 /// 用户
				 /// </summary>
				 public static Field UsersId { private set;get; }
	    		 

			}
	}
}